import mock from 'xhr-mock';
const mockTempleList = [{
  data: {
    rows: [
      {
        "id": 1,
        "name": "mock数据宋江",
        "sex": "M",
        "age": "68",
        "email": "6888888@qq.com",
        "active": true
      },
      {
        "id": 2,
        "name": "mock数据张飞",
        "sex": "M",
        "age": "60",
        "email": "zhangfei@163.com",
        "active": true
      },
      {
        "id": 3,
        "name": "mock数据赵云",
        "sex": "M",
        "age": "25",
        "email": "zhaoyun@163.com",
        "active": true
      },
      {
        "id": 4,
        "name": "mock数据廉颇",
        "sex": "M",
        "age": "88",
        "email": "61238@google.com",
        "active": false
      },
      {
        "id": 5,
        "name": "mock数据秦秀英",
        "sex": "F",
        "age": "12",
        "email": "6qxy8@hand-china.com",
        "active": true
      },
      {
        "id": 6,
        "name": "mock数据孔秀兰",
        "sex": "F",
        "age": "24",
        "email": "123368@qq.com",
        "active": true
      },
      {
        "id": 7,
        "name": "mock数据马芳",
        "sex": "F",
        "age": "10",
        "email": "mafangs@163.com",
        "active": false
      },
      {
        "id": 8,
        "name": "mock数据鲁智深",
        "sex": "M",
        "age": "48",
        "email": "6handlzs8@hand-china.com",
        "active": true
      }
    ],
    success: true,
    total: 10,
  },
  rule: /\/tableuser.mock/
}]

export function setup() {
  mock.setup();
  if (mockTempleList.length >= 1) {
    mockTempleList.map((item) => {
      const { rule, data } = item;
      mock.post(rule, {
        status: 201,
        body: JSON.stringify(data),
      });
    });
  }
}

export const teardown = mock.teardown.bind(mock);

export const rows = [
  {
    expand: false,
    functionCode: 'EMPLOYEE_REACT',
    icon: 'record_test',
    id: 7,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '员工管理(react)',
    url: 'hap-core/hr/employee',
    symbol: '1',
    parentId: 2,
  },
  {
    expand: false,
    functionCode: 'HR_UNIT',
    icon: 'fa fa-cube',
    id: 73,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '组织管理',
    url: 'hr/org_unit.html',
    symbol: '0',
    parentId: 2,
  },
  {
    expand: false,
    functionCode: 'COMPANY_REACT',
    icon: 'mail_set',
    id: 12,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '公司管理(react)',
    url: 'hap-core/hr/company',
    symbol: '1',
    parentId: 2,
  },
  {
    expand: false,
    functionCode: 'ORGUNIT_REACT',
    icon: 'authority',
    id: 5,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '组织管理(react)',
    url: 'hap-core/hr/orgunit',
    symbol: '1',
    parentId: 2,
  },
  {
    expand: false,
    functionCode: 'POSITION_REACT',
    icon: 'agile_subtask',
    id: 6,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '岗位管理(react)',
    url: 'hap-core/hr/position',
    symbol: '1',
    parentId: 2,
  },
  {
    expand: false,
    functionCode: 'HR_POSITION',
    icon: 'fa fa-user-secret',
    id: 75,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '岗位管理',
    url: 'hr/position.html',
    symbol: '0',
    parentId: 2,
  },
  {
    expand: false,
    functionCode: 'HR_EMPLOYEE',
    icon: 'fa fa-user',
    id: 74,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '员工管理',
    url: 'hr/employee.html',
    symbol: '0',
    parentId: 2,
  },
  {
    expand: false,
    functionCode: 'FND_COMPANY',
    icon: 'fa fa-cube',
    id: 76,
    ischecked: null,
    score: 40,
    shortcutId: null,
    text: '公司管理',
    url: 'fnd/company.html',
    symbol: '0',
    parentId: 2,
  },
  {
    expand: false,
    functionCode: 'HR',
    icon: 'fa fa-cubes',
    id: 2,
    ischecked: null,
    score: 10,
    shortcutId: null,
    text: '组织架构',
    url: null,
    symbol: '0',
  },
  {
    expand: false,
    functionCode: 'SYS_REPORT_LIST',
    icon: 'fa fa-user',
    id: 25,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '报表定义',
    url: 'rpt/report.html',
    symbol: '0',
    parentId: 24,
  },
  {
    expand: false,
    functionCode: 'SYS_REPORT_DESIGN',
    icon: 'fa fa-user',
    id: 26,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '报表设计',
    url: 'ureport/designer',
    symbol: '0',
    parentId: 24,
  },
  {
    expand: false,
    functionCode: 'SYS_REPORT_MANAGE',
    icon: 'fa fa-user',
    id: 24,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '报表管理',
    url: null,
    symbol: '0',
  },
  {
    expand: false,
    functionCode: 'ATTACH_CATEGORY',
    icon: 'fa fa-folder-open',
    id: 72,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '目录管理',
    url: 'attach/sys_attach_category_manage.html',
    symbol: '0',
    parentId: 69,
  },
  {
    expand: false,
    functionCode: 'ATTACH_FILE',
    icon: 'fa fa-file',
    id: 70,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '文件管理',
    url: 'attach/sys_file_manage.html',
    symbol: '0',
    parentId: 69,
  },
  {
    expand: false,
    functionCode: 'ATTACH_TEST',
    icon: 'fa fa-file',
    id: 71,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '上传测试',
    url: 'attach/sys_attachment_create.html',
    symbol: '0',
    parentId: 69,
  },
  {
    expand: false,
    functionCode: 'ATTACH',
    icon: 'fa fa-cloud-upload',
    id: 69,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '附件管理',
    url: null,
    symbol: '0',
  },
  {
    expand: false,
    functionCode: 'JOB_DETAIL',
    icon: 'fa fa-tasks',
    id: 17,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '任务明细',
    url: 'job/job_detail.html',
    symbol: '0',
    parentId: 16,
  },
  {
    expand: false,
    functionCode: 'JOB_RUNNING_INFO',
    icon: 'fa fa-list-ul',
    id: 18,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '执行记录',
    url: 'job/job_running_info.html',
    symbol: '0',
    parentId: 16,
  },
  {
    expand: false,
    functionCode: 'JOB',
    icon: 'fa fa-clock-o',
    id: 16,
    ischecked: true,
    score: 40,
    shortcutId: null,
    text: '计划任务',
    url: null,
    symbol: '0',
  },
  {
    expand: false,
    functionCode: 'WFL_AUTO_DELEGATE',
    icon: 'fa fa-user-plus',
    id: 44,
    ischecked: true,
    score: 5,
    shortcutId: null,
    text: '自动转交配置',
    url: 'activiti/auto_delegate_config.html',
    symbol: '0',
    parentId: 39,
  },
  {
    expand: false,
    functionCode: 'WFL_MY_START',
    icon: 'fa fa-share',
    id: 41,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '我发起的流程',
    url: 'wfl/activiti/process_history_start.html',
    symbol: '0',
    parentId: 39,
  },
  {
    expand: false,
    functionCode: 'WFL_MY_TASK',
    icon: 'fa fa-check-square-o',
    id: 42,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '我的待办列表',
    url: 'activiti/my_task.html',
    symbol: '0',
    parentId: 39,
  },
  {
    expand: false,
    functionCode: 'WFL_HISROTY',
    icon: 'fa fa-history',
    id: 43,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '我参与的流程',
    url: 'activiti/process_history.html',
    symbol: '0',
    parentId: 39,
  },
  {
    expand: false,
    functionCode: 'WFL_CARBON',
    icon: 'fa fa-reply',
    id: 40,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '我的抄送流程',
    url: 'wfl/activiti/process_history_carbon.html',
    symbol: '0',
    parentId: 39,
  },
  {
    expand: false,
    functionCode: 'WFL_OFFICE',
    icon: 'fa fa-user',
    id: 39,
    ischecked: true,
    score: 49,
    shortcutId: null,
    text: '工作流',
    url: null,
    symbol: '0',
  },
  {
    expand: false,
    functionCode: 'WFL_TEST',
    icon: 'fa fa-wrench',
    id: 30,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '工作流测试',
    url: 'activiti/start_process_test.html',
    symbol: '0',
    parentId: 27,
  },
  {
    expand: false,
    functionCode: 'WFL_VACATION_TEST',
    icon: 'fa fa-wrench',
    id: 38,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '工作流测试(请假申请)',
    url: 'activiti/demo/vacation_list.html',
    symbol: '0',
    parentId: 27,
  },
  {
    expand: false,
    functionCode: 'WFL_TASK',
    icon: 'fa fa-check-square-o',
    id: 28,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '待办事项(管理员)',
    url: 'activiti/task_list.html',
    symbol: '0',
    parentId: 27,
  },
  {
    expand: false,
    functionCode: 'WFL_MODEL',
    icon: 'fa fa-object-group',
    id: 29,
    ischecked: true,
    score: 40,
    shortcutId: null,
    text: '流程设计',
    url: 'activiti/models.html',
    symbol: '0',
    parentId: 27,
  },
  {
    expand: false,
    functionCode: 'WFL_DEFINITION',
    icon: 'fa fa-share-alt',
    id: 31,
    ischecked: true,
    score: 50,
    shortcutId: null,
    text: '流程部署',
    url: 'activiti/process_definitions.html',
    symbol: '0',
    parentId: 27,
  },
  {
    expand: false,
    functionCode: 'WFL_LOG',
    icon: 'fa fa-check-square-o',
    id: 33,
    ischecked: true,
    score: 60,
    shortcutId: null,
    text: '报错日志',
    url: 'activiti/execption.html',
    symbol: '0',
    parentId: 27,
  },
  {
    expand: false,
    functionCode: 'WFL_MONITOR',
    icon: 'fa fa-check-square-o',
    id: 32,
    ischecked: true,
    score: 60,
    shortcutId: null,
    text: '流程监控',
    url: 'activiti/process_monitor.html',
    symbol: '0',
    parentId: 27,
  },
  {
    expand: false,
    functionCode: 'WFL_APV_STRATEGY',
    icon: 'fa fa-users',
    id: 35,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '审批方式',
    url: 'activiti/approval/approve_strategy.html',
    symbol: '0',
    parentId: 34,
  },
  {
    expand: false,
    functionCode: 'WFL_APV_TYPE',
    icon: 'fa fa-user-plus',
    id: 36,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '审批规则',
    url: 'activiti/approval/approve_candidate_rule.html',
    symbol: '0',
    parentId: 34,
  },
  {
    expand: false,
    functionCode: 'WFL_APV_RULE',
    icon: 'fa fa-gavel',
    id: 37,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '审批权限',
    url: 'activiti/approval/business_rule_header.html',
    symbol: '0',
    parentId: 34,
  },
  {
    expand: false,
    functionCode: 'WFL_APPROVE',
    icon: 'fa fa-cog',
    id: 34,
    ischecked: true,
    score: 90,
    shortcutId: null,
    text: '审批配置',
    url: null,
    symbol: '0',
    parentId: 27,
  },
  {
    expand: false,
    functionCode: 'WFL',
    icon: 'fa fa-sitemap',
    id: 27,
    ischecked: true,
    score: 50,
    shortcutId: null,
    text: '流程管理',
    url: null,
    symbol: '0',
  },
  {
    expand: false,
    functionCode: 'IF_CONFIG',
    icon: 'fa fa-share-alt-square',
    id: 46,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '接口定义',
    url: 'intergration/sys_interface_header.html',
    symbol: '0',
    parentId: 45,
  },
  {
    expand: false,
    functionCode: 'IF_INVOKE',
    icon: 'fa fa-bar-chart',
    id: 89,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '调用记录',
    url: 'intergration/sys_interface_invoke.html',
    symbol: '0',
    parentId: 45,
  },
  {
    expand: false,
    functionCode: 'IF_CLIENT',
    icon: 'fa fa-laptop',
    id: 47,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '客户端管理',
    url: 'sys/sys_oauth_client_details.html',
    symbol: '0',
    parentId: 45,
  },
  {
    expand: false,
    functionCode: 'IF_TOKEN',
    icon: 'fa fa-lock',
    id: 48,
    ischecked: true,
    score: 40,
    shortcutId: null,
    text: '授权管理',
    url: 'sys/sys_token_logs.html',
    symbol: '0',
    parentId: 45,
  },
  {
    expand: false,
    functionCode: 'IF',
    icon: 'fa fa-plug',
    id: 45,
    ischecked: true,
    score: 80,
    shortcutId: null,
    text: '接口管理',
    url: null,
    symbol: '0',
  },
  {
    expand: false,
    functionCode: 'API_SERVER',
    icon: 'fa fa-registered',
    id: 50,
    ischecked: true,
    score: 5,
    shortcutId: null,
    text: '服务注册',
    url: 'gateway/api_server.html',
    symbol: '0',
    parentId: 49,
  },
  {
    expand: false,
    functionCode: 'API_APPLICATION',
    icon: 'fa fa-th-large',
    id: 51,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '应用管理',
    url: 'gateway/api_application.html',
    symbol: '0',
    parentId: 49,
  },
  {
    expand: false,
    functionCode: 'API_INVOKE',
    icon: 'fa fa-book',
    id: 52,
    ischecked: true,
    score: 15,
    shortcutId: null,
    text: '调用记录',
    url: 'gateway/api_invoke_record.html',
    symbol: '0',
    parentId: 49,
  },
  {
    expand: false,
    functionCode: 'API',
    icon: 'fa fa-server',
    id: 49,
    ischecked: true,
    score: 90,
    shortcutId: null,
    text: '服务管理',
    url: null,
    symbol: '0',
  },
  {
    expand: false,
    functionCode: 'TASK_DETAIL',
    icon: 'fa fa-life-saver',
    id: 54,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '任务管理',
    url: 'task/task_details.html',
    symbol: '0',
    parentId: 53,
  },
  {
    expand: false,
    functionCode: 'TASK_EXECUTE',
    icon: 'fa fa-terminal',
    id: 55,
    ischecked: true,
    score: 15,
    shortcutId: null,
    text: '任务执行',
    url: 'task/task_execute.html',
    symbol: '0',
    parentId: 53,
  },
  {
    expand: false,
    functionCode: 'TASK_EXECUTION',
    icon: 'fa fa-archive',
    id: 56,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '执行记录',
    url: 'task/task_execution.html',
    symbol: '0',
    parentId: 53,
  },
  {
    expand: false,
    functionCode: 'TASK_ADMIN_EXECUTION',
    icon: 'fa fa-archive',
    id: 57,
    ischecked: true,
    score: 25,
    shortcutId: null,
    text: '执行记录(管理员)',
    url: 'sys/task/execution/admin/task_execution.html',
    symbol: '0',
    parentId: 53,
  },
  {
    expand: false,
    functionCode: 'TASK',
    icon: 'fa fa-tasks',
    id: 53,
    ischecked: true,
    score: 95,
    shortcutId: null,
    text: '任务管理',
    url: null,
    symbol: '0',
  },
  {
    expand: false,
    functionCode: 'SYS_CONFIG',
    icon: 'fa fa-cog',
    id: 63,
    ischecked: true,
    score: 6,
    shortcutId: null,
    text: '系统配置',
    url: 'sys/sys_config.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'SYS_METRICS',
    icon: 'fa fa-heartbeat',
    id: 78,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '系统指标',
    url: 'sys/sys_detail_metrics.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'ACCOUNT_USER',
    icon: 'fa fa-user-plus',
    id: 64,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '用户管理',
    url: 'sys/sys_user.html',
    symbol: '0',
    parentId: 8,
  },
  {
    expand: false,
    functionCode: 'ACCOUNT_USER_REACT',
    icon: 'task_schedule',
    id: 9,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '用户管理(react)',
    url: 'hap-core/account/user',
    symbol: '1',
    parentId: 8,
  },
  {
    expand: false,
    functionCode: 'ACCOUNT_ROLE_REACT',
    icon: 'test_execute',
    id: 10,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '角色管理(react)',
    url: 'hap-core/account/role',
    symbol: '1',
    parentId: 8,
  },
  {
    expand: false,
    functionCode: 'ACCOUNT_ROLE',
    icon: 'fa fa-users',
    id: 65,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '角色管理',
    url: 'sys/sys_role.html',
    symbol: '0',
    parentId: 8,
  },
  {
    expand: false,
    functionCode: 'ACCOUNT',
    icon: 'fa fa-user',
    id: 8,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '账户管理',
    url: null,
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'FORM',
    icon: 'fa fa-newspaper-o',
    id: 87,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '表单管理',
    url: 'sys/ui-builder.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'HOTKEY',
    icon: 'fa fa-keyboard-o',
    id: 88,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '热键配置',
    url: 'sys/sys_hotkey.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'FUNCTION_ADD',
    icon: 'fa fa-puzzle-piece',
    id: 66,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '功能维护',
    url: 'sys/sys_function.html',
    symbol: '0',
    parentId: 3,
  },
  {
    expand: false,
    functionCode: 'RESOYRCE_REACT',
    icon: 'report_overview',
    id: 11,
    ischecked: null,
    score: 10,
    shortcutId: null,
    text: '资源管理(react)',
    url: 'hap-core/sys/resource',
    symbol: '1',
    parentId: 3,
  },
  {
    expand: false,
    functionCode: 'FUNCTION_REACT',
    icon: 'functions',
    id: 13,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '功能维护(react)',
    url: 'hap-core/sys/function',
    symbol: '1',
    parentId: 3,
  },
  {
    expand: false,
    functionCode: 'SYS_RESOURCE',
    icon: 'fa fa-share-alt-square',
    id: 67,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '资源管理',
    url: 'sys/sys_resource.html',
    symbol: '0',
    parentId: 3,
  },
  {
    expand: false,
    functionCode: 'FUNCTION_ASSIGN',
    icon: 'fa fa-list',
    id: 68,
    ischecked: true,
    score: 90,
    shortcutId: null,
    text: '功能分配',
    url: 'sys/sys_role_function.html',
    symbol: '0',
    parentId: 3,
  },
  {
    expand: false,
    functionCode: 'FUNCTION',
    icon: 'fa fa-plug',
    id: 3,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '功能管理',
    url: null,
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'SYS_DASHBOARD',
    icon: 'fa fa-dashboard',
    id: 77,
    ischecked: true,
    score: 15,
    shortcutId: null,
    text: '仪表盘配置',
    url: 'sys/sys_dashboard.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'PROMPT',
    icon: 'fa fa-edit',
    id: 58,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '描述维护',
    url: 'sys/sys_prompt.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'PROMPT_REACT',
    icon: 'description',
    id: 14,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '描述维护(react)',
    url: 'hap-core/sys/prompt',
    symbol: '1',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'CODE',
    icon: 'fa fa-code',
    id: 59,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '代码维护',
    url: 'sys/sys_code.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'CODE_REACT',
    icon: 'operation_help',
    id: 4,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '代码维护(react)',
    url: 'hap-core/sys/code',
    symbol: '1',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'LOV',
    icon: 'fa fa-search',
    id: 60,
    ischecked: true,
    score: 40,
    shortcutId: null,
    text: 'LOV定义',
    url: 'sys/sys_lov.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'SYS_CODE_RULE',
    icon: 'fa fa-cube',
    id: 83,
    ischecked: true,
    score: 45,
    shortcutId: null,
    text: '编码规则',
    url: 'code/rule/code_rules.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'LANGUAGE',
    icon: 'fa fa-flag',
    id: 61,
    ischecked: true,
    score: 50,
    shortcutId: null,
    text: '语言维护',
    url: 'sys/sys_language.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'LANGUAGE_REACT',
    icon: 'language',
    id: 15,
    ischecked: true,
    score: 50,
    shortcutId: null,
    text: '语言维护(react)',
    url: 'hap-core/sys/language',
    symbol: '1',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'PROFILE',
    icon: 'fa fa-cogs',
    id: 62,
    ischecked: true,
    score: 50,
    shortcutId: null,
    text: '配置维护',
    url: 'sys/sys_profile.html',
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'CODE_RULE_REACT',
    icon: 'report_overview',
    id: 90,
    ischecked: true,
    score: 60,
    shortcutId: null,
    text: '编码规则(react)',
    url: 'hap-core/sys/code_rules',
    symbol: '1',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'EMAIL_ACCOUNT',
    icon: 'fa fa-envelope',
    id: 20,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '邮件账户',
    url: 'mail/sys_message_email_config.html',
    symbol: '0',
    parentId: 19,
  },
  {
    expand: false,
    functionCode: 'EMAIL_TEMPLATE',
    icon: 'fa fa-envelope',
    id: 21,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '邮件模板',
    url: 'mail/sys_message_template.html',
    symbol: '0',
    parentId: 19,
  },
  {
    expand: false,
    functionCode: 'EMAIL_TEST',
    icon: 'fa fa-envelope',
    id: 22,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '邮件测试',
    url: 'mail/sys_message_test.html',
    symbol: '0',
    parentId: 19,
  },
  {
    expand: false,
    functionCode: 'EMAIL_STATUS',
    icon: 'fa fa-envelope',
    id: 23,
    ischecked: true,
    score: 40,
    shortcutId: null,
    text: '邮件状态查询',
    url: 'mail/message_status.html',
    symbol: '0',
    parentId: 19,
  },
  {
    expand: false,
    functionCode: 'EMAIL',
    icon: 'fa fa-envelope',
    id: 19,
    ischecked: true,
    score: 80,
    shortcutId: null,
    text: '邮件',
    url: null,
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'FLEX_FIELD_MODEL',
    icon: 'fa fa-object-ungroup',
    id: 80,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '弹性域模型',
    url: 'flexfield/flex_model.html',
    symbol: '0',
    parentId: 79,
  },
  {
    expand: false,
    functionCode: 'FLEX_FIELD_RULE_SET',
    icon: 'fa fa-object-ungroup',
    id: 81,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '弹性域规则',
    url: 'flexfield/flex_rule_set.html',
    symbol: '0',
    parentId: 79,
  },
  {
    expand: false,
    functionCode: 'FLEX_FIELD_DEMO',
    icon: 'fa fa-object-ungroup',
    id: 82,
    ischecked: true,
    score: 30,
    shortcutId: null,
    text: '弹性域示例',
    url: 'demo/flexfield.html',
    symbol: '0',
    parentId: 79,
  },
  {
    expand: false,
    functionCode: 'FLEX_FIELD',
    icon: 'fa fa-object-group',
    id: 79,
    ischecked: true,
    score: 90,
    shortcutId: null,
    text: '弹性域',
    url: null,
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'DATA_PERMISSION_RULE',
    icon: 'fa fa-user-times',
    id: 85,
    ischecked: true,
    score: 10,
    shortcutId: null,
    text: '屏蔽规则管理',
    url: 'permission/data_permission_rule.html',
    symbol: '0',
    parentId: 84,
  },
  {
    expand: false,
    functionCode: 'DATA_PERMISSION_TABLE',
    icon: 'fa fa-user-times',
    id: 86,
    ischecked: true,
    score: 20,
    shortcutId: null,
    text: '屏蔽权限设置',
    url: 'permission/data_permission_table.html',
    symbol: '0',
    parentId: 84,
  },
  {
    expand: false,
    functionCode: 'DATA_PERMISSION',
    icon: 'fa fa-user-times',
    id: 84,
    ischecked: false,
    score: 100,
    shortcutId: null,
    text: '数据屏蔽',
    url: null,
    symbol: '0',
    parentId: 1,
  },
  {
    expand: false,
    functionCode: 'SYSTEM',
    icon: 'fa fa-gears',
    id: 1,
    ischecked: true,
    score: 99,
    shortcutId: null,
    text: '系统管理',
    url: null,
    symbol: '0',
  },
];

export const testName = 'testName';
export const data = [
  {
    "userid": 1,
    "name": "假数据宋江",
    "sex": "M",
    "age": 68,
    "email": "6888888@qq.com",
    "active": true
  },
  {
    "userid": 2,
    "name": "假数据张飞",
    "sex": "M",
    "age": 60,
    "email": "zhangfei@163.com",
    "active": true
  },
  {
    "userid": 3,
    "name": "假数据赵云",
    "sex": "M",
    "age": 25,
    "email": "zhaoyun@163.com",
    "active": true
  },
  {
    "userid": 4,
    "name": "假数据廉颇",
    "sex": "M",
    "age": 88,
    "email": "61238@google.com",
    "active": false
  },
  {
    "userid": 5,
    "name": "假数据秦秀英",
    "sex": "F",
    "age": 12,
    "email": "6qxy8@hand-china.com",
    "active": true
  },
  {
    "userid": 6,
    "name": "假数据孔秀兰",
    "sex": "F",
    "age": 24,
    "email": "123368@qq.com",
    "active": true
  },
  {
    "userid": 7,
    "name": "假数据马芳",
    "sex": "F",
    "age": 10,
    "email": "mafangs@163.com",
    "active": false
  },
  {
    "userid": 8,
    "name": "假数据鲁智深",
    "sex": "M",
    "age": 48,
    "email": "6handlzs8@hand-china.com",
    "active": true
  }
];
export const commonDs = {
  primaryKey: 'userid',
  fields: [
    {
      name: 'userid',
      type: 'number',
      label: '编号',
      required: true,
    },
    {
      name: 'name',
      type: 'string',
      label: '姓名',
    },
    {
      name: 'age',
      type: 'number',
      label: '年龄',
    },
    {
      name: 'sex',
      type: 'string',
      label: '性别',
      lookupCode: 'HR.EMPLOYEE_GENDER',
      required: true,
    },
    { name: 'email', type: 'string', label: '邮箱' },
    { name: 'active', type: 'boolean', label: '在线' },
  ],
  transport: {
    read: () => {
      return {
        // 此处设置的url无效，但是官网是可行的
        url: 'https://www.fastmock.site/mock/423302b318dd24f1712751d9bfc1cbbc/mock/guide/user',
        method: 'GET',
      };
    }
  },
};
export const commonQueryFields = [
  { name: 'enable', type: 'boolean', label: '是否开启' },
  { name: 'name', type: 'string', label: '姓名', defaultValue: 'Hugh' },
  { name: 'age', type: 'number', label: '年龄' },
]
export const commonColumns = [
  { name: 'userid' },
  { name: 'name', editor: true },
  { name: 'age', editor: true },
  { name: 'sex', editor: true },
  { name: 'email', editor: true },
  { name: 'active', editor: true },
];
export const simpleTreeDs = {
  primaryKey: 'userid',
  autoQuery: true,
  parentField: 'parentId',
  expandField: 'expand',
  idField: 'userid',
  fields: [
    { name: 'userid', type: 'number' },
    { name: 'expand', type: 'boolean' },
    { name: 'parentId', type: 'number' },
    { name: 'check', type: 'boolean' }
  ],
  data: [
    { userid: 1, check: false, expand: true },
    { userid: 11, parentId: 1, check: false, expand: true },
    { userid: 12, parentId: 1, check: false, expand: true },
    { userid: 13, parentId: 1, check: false, expand: true },
  ],
};
export const largeTreeDs = {
  primaryKey: 'userid',
  // queryUrl: 'https://www.fastmock.site/mock/423302b318dd24f1712751d9bfc1cbbc/mock/treeqqq',
  // submitUrl: 'https://www.fastmock.site/mock/423302b318dd24f1712751d9bfc1cbbc/mock/tree',
  autoQuery: true,
  parentField: 'parentId',
  idField: 'userid',
  checkField: 'ischecked',
  combineSort: true,
  paging: 'server',
  fields: [
    { name: 'userid', type: 'number' },
    { name: 'text', type: 'string', label: '功能名称' },
    { name: 'url', type: 'string', label: '入口页面' },
    { name: 'expand', type: 'boolean', label: '是否展开' },
    { name: 'ischecked', type: 'boolean', label: '是否开启' },
    { name: 'score', type: 'number', label: '顺序', order: 'asc' },
    { name: 'parentId', type: 'number' },
  ],
  data: rows,
};
export const childDs = {
  fields: [
    { name: 'nickName', type: 'string' },
    { name: 'age', type: 'number' },
  ],
};
export const fatherDs = {
  fields: [
    { name: 'info', type: 'object' },
    { name: 'name', type: 'string' },
    { name: 'tel', type: 'string' }
  ],
  data: [
    {
      name: 'testName',
      tel: '13320346755',
      info: {
        view: [
          { nickName: 'testNickName', age: 12 },
        ],
      },
    },
    {
      name: '曹操',
      tel: '8008208820',
      info: {
        view: [
          { nickName: '孟德', age: 18 },
        ],
      },
    },
  ],
};


export const treeTableData = (parentLength, childrenLength, grandChildrenLength) => {
  const template = {
    creationDate: '2021-09-03 15:57:39',
    createdBy: 25,
    lastUpdateDate: '2021-09-03 15:57:39',
    lastUpdatedBy: 25,
    objectVersionNumber: 1,
    _token:
      'WBNovgcQn7gFNmRPkVWyZmLRG8f1OgTzE8WjA98WlgfrUKjSG3s3RLLZhwBO8UAWlQzWLwBYxJunxnQZtDZ+zFLAISGdg3N0ifurKcejVmoU2QjFc3ACLhKba+Lk8NegCuDKN+6jgKCQ+1CaHjsgcX92opAi3CgKfvJFRk323VA=',
    businessObjectRelationId: '=L8-NXHp_X9x3I6IzxjuscBXkDK-SxU15OW9FONvtouE==',
    businessObjectId: '=ByrKpV7mRrCOXs_A34jIAg7-NJT3OEKaTPvdD8nKgJw==',
    relateBusinessObjectCode: 'heto_contract_trading',
    parentBusinessObjectFieldCode: 'partner',
    relateType: 'LINK',
    orderSeq: '1',
    tenantId: 0,
    relateBusinessObjectFieldCode: null,
    relBusinessObjectName: '交易方',
    relBusinessObjectFieldName: '交易方',
    businessObjectRelationFieldList: [],
    businessObjectRelationList: null,
    relBusinessObjectFieldId: null,
    componentType: null,
  };
  const fieldTemplate = {
    creationDate: null,
    createdBy: null,
    lastUpdateDate: null,
    lastUpdatedBy: null,
    objectVersionNumber: 1,
    _token:
      'WBNovgcQn7gFNmRPkVWyZmLRG8f1OgTzE8WjA98WlgfrUKjSG3s3RLLZhwBO8UAWlQzWLwBYxJunxnQZtDZ+zPyI8LzB6FeaLBT8GKF09Qpf5LAY3mdvVkgS+bHL2/zvS0NbAkXENtbm6U3k8ClBzhpCDIrrHvoldyLfhaYcx1GZkwCE36qMrTka9tXVb5xt',
    businessObjectRelationFieldId:
      '=BrMInoE3beHbz4Td5n2MFtpAYfAAmRhArZ9toMUEd2g==',
    businessObjectRelationId: '=L8-NXHp_X9x3I6IzxjuscBXkDK-SxU15OW9FONvtouE==',
    businessObjectCode: 'heto_contract_trading',
    businessObjectFieldCode: 'createdBy',
    aliasName: '创建人2',
    displayName: null,
    tenantId: 0,
    businessObjectFieldName: '创建人',
    componentType: 'NUMBER_FIELD',
    businessObjectFieldId: 221555985198661630,
    businessObjectName: '交易方',
  };
  const data = [];
  for (let i = 0; i < parentLength; i++) {
    const child = [];
    const _data1 = { ...template };
    Object.assign(_data1, {
      relBusinessObjectId: i,
      id: i,
    });
    // 创建字段
    for (let j = 0; j < childrenLength; j++) {
      const grandChildren = [];
      const _data2 = { ...fieldTemplate };
      Object.assign(_data2, { parentId: i });
      Object.assign(_data2, { id: `${i}-${j}` });
      child.push(_data2);
      if (grandChildrenLength) {
        for (let k = 0; k < grandChildrenLength; k++) {
          const _data3 = { ...fieldTemplate };
          Object.assign(_data3, { parentId: i });
          Object.assign(_data3, { id: `${i}-${j}-${k}` });
          grandChildren.push(_data3);
          _data2.businessObjectRelationFieldList = grandChildren;
        }
      }
    }
    _data1.businessObjectRelationFieldList = child;
    data.push(_data1);
  }
  return data;
}

// 用于Table中的树形Ds数据模拟
export const mockTableTreeDs = (parentLength, childrenLength, grandChildrenLength) => {
  const tableTreeDs = {
    primaryKey: 'id',
    autoQuery: false,
    childrenField: 'businessObjectRelationFieldList',
    expandField: 'expand',
    paging: false,
    autoLocateFirst: false,
    data: treeTableData(parentLength, childrenLength, grandChildrenLength),
    fields: [
      { name: 'id', type: 'string' },
      { name: 'parentId', type: 'string', parentFieldName: 'id' },
      {
        name: 'businessObjectFieldName',
        type: 'string',
        label: '字段名称',
      },
      {
        name: 'displayName',
        type: 'string',
        label: '字段显示名称',
      },
      {
        name: 'componentType',
        type: 'string',
        label: '字段类型',
      },
    ],
  }
  return tableTreeDs;
}
